const FILE_MGR =
  FileManager[
    module.filename.includes('Documents/iCloud~') ? 'iCloud' : 'local'
  ]();
await Promise.all(
  ['vinoTool.js', 'Demo.js'].map(async (js) => {
    const REQ = new Request(
      `https://gitee.com/augustvino/scriptable/raw/master/Scripts/${encodeURIComponent(
        js
      )}`
    );
    const RES = await REQ.load();
    FILE_MGR.write(FILE_MGR.joinPath(FILE_MGR.documentsDirectory(), js), RES);
  })
);
FILE_MGR.remove(module.filename);

Safari.open('scriptable:///open?scriptName=' + encodeURIComponent('Demo'));
